using Raven.Client;

namespace OpenWaves.ActivityFeed.RavenDB
{
    public static class ActivityFeedDocumentStore
    {
        private static volatile IDocumentStore current;
        private static readonly object syncLock = new object();

        public static IDocumentStore Current
        {
            get
            {
                if (current == null)
                {
                    lock (syncLock)
                    {
                        if (current == null)
                        {
                            current = ServiceLocator.Resolve<IDocumentStoreFactory>().CreateInitializedDocumentStore();
                        }
                    }
                }

                return current;
            }
        }
    }
}